<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>九九乘法表</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: Arial, sans-serif;
        }

        body {
            background-color: #1a2533;
            color: #fff;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            padding: 20px;
        }

        .container {
            background-color: #253347;
            padding: 20px;
            border-radius: 10px;
            width: 100%;
            max-width: 600px;
            text-align: center;
        }

        h2 {
            margin-bottom: 20px;
        }

        .input-group {
            margin-bottom: 15px;
        }

        .input-group label {
            display: block;
            margin-bottom: 5px;
        }

        .input-group input {
            width: 100%;
            padding: 8px;
            border: none;
            border-radius: 5px;
            background-color: #1a2533;
            color: #fff;
        }

        button {
            background-color: #1da1f2;
            color: #fff;
            border: none;
            padding: 10px 20px;
            border-radius: 5px;
            cursor: pointer;
            margin-top: 10px;
        }

        button:hover {
            background-color: #0d8ecf;
        }

        #multiplicationTable {
            margin-top: 20px;
            font-size: 16px;
            text-align: left;
            display: inline-block;
        }

        #multiplicationTable p {
            margin: 5px 0;
        }
    </style>
</head>
<body>
    <div class="container">
        <h2>九九乘法表</h2>
        <div class="input-group">
            <label for="username">用户名</label>
            <input type="text" id="username" placeholder="请输入用户名（至少8个字符）">
        </div>
        <div class="input-group">
            <label for="password">密码</label>
            <input type="password" id="password" placeholder="请输入密码（至少20个字符）">
        </div>
        <button onclick="login()">登录</button>
        <div id="multiplicationTable"></div>
    </div>

    <script>
        function login() {
            // 获取输入值
            const username = document.getElementById('username').value;
            const password = document.getElementById('password').value;
            const tableDiv = document.getElementById('multiplicationTable');

            // 数据验证
            if (username.length < 8) {
                alert('用户名必须至少8个字符！');
                document.getElementById('username').value = '';
                document.getElementById('password').value = '';
                tableDiv.innerHTML = '';
                return;
            }

            if (password.length < 20) {
                alert('密码必须至少20个字符！');
                document.getElementById('username').value = '';
                document.getElementById('password').value = '';
                tableDiv.innerHTML = '';
                return;
            }

            // 显示九九乘法表
            let tableHTML = `<p>${username}，你好！九九乘法表如下</p >`;
            for (let i = 1; i <= 9; i++) {
                let row = '';
                for (let j = 1; j <= i; j++) {
                    row += `${j}*${i}=${i * j} `;
                }
                tableHTML += `<p>${row}</p >`;
            }
            tableDiv.innerHTML = tableHTML;
        }
    </script>
</body>
</html>